public class tables {
    public static void main (String[] args){
        final StringBuilder tableBuilder = new StringBuilder();
        for (int row = 1; row <= 12; row++) {
                for (int col = 1; col <= 12; col++) {
                        // Calculate the entry for the current cell.
                        final String currentValue = Integer.toString(col * row);

                        // Left-pad the number with spaces to right-align it.
                        final int padding = 4 - currentValue.length();
                        for (int i = 0; i < padding; i++) {
                                tableBuilder.append(" ");
                        }

                        // Append the entry for the current cell to the output.
                        tableBuilder.append(currentValue);
                }
                tableBuilder.append("\n");
        }

        System.out.println(tableBuilder.toString());
}
}